package map_set.leetcode;

import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

/**
 * @Description: 列出肯定坏掉的那些键
 * @Author Stark
 * @Date 2022/3/12 16:54
 **/
public class NowCoder_OldKeyboard {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String expectedStr = null;
        String realStr = null;
        while(scanner.hasNext()) {
            expectedStr = scanner.next();
            realStr = scanner.next();
        }
        //转为大写
        expectedStr = expectedStr.toUpperCase();
        realStr = realStr.toUpperCase();
        StringBuilder sb = new StringBuilder();
        //将实际输入的文字存入rSet中
        Set<Character> rSet = new HashSet<>();
        for (int i = 0; i < realStr.length(); i++) {
            rSet.add(realStr.charAt(i));
        }
        //将期望输入的文字存入eSet进行去重并进行判断
        Set<Character> eSet = new HashSet<>();
        for (int i = 0; i < expectedStr.length(); i++) {
            char ch = expectedStr.charAt(i);
            //当eSet没有该字符时
            if (!eSet.contains(ch)) {
                //当rSet中不存在时,说明改键坏掉了
                if (!rSet.contains(ch)) {
                    sb.append(ch);
                }
                //把该字符存入Set中
                eSet.add(ch);
            }
        }
        System.out.println(sb.toString());
    }
}
